<template>
  <div>
    <div :class="['container', 'animate__animated', animateType]">
      <div :class="['header', 'animate__animated', animateType]">
        <div class="title">{{ title }}</div>
        <!-- <slot name="tab" /> -->
      </div>
      <div :class="['content', 'animate__animated', animateType]">
        <!-- <slot name="content" /> -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HerinContainer',
  props: {
    title: {
      type: String,
      default: '标题'
    }
  },
  data () {
    return {
      animateType: 'animate__fadeIn'
    }
  },
  mounted () {
    this.$nextTick(() => {
      this.requestAnimate()
    })
  },
  methods: {
    requestAnimate () {
      if (this.title === '入场动画1') {
        this.animateType = 'animate__zoomIn'
      } else if (this.title === '离场动画1') {
        this.animateType = 'animate__zoomOut'
      } else if (this.title === '入场动画2') {
        this.animateType = 'animate__fadeIn'
      } else if (this.title === '离场动画2') {
        this.animateType = 'animate__fadeOut'
      } else if (this.title === '入场动画3') {
        this.animateType = 'animate__bounceIn'
      } else if (this.title === '离场动画3') {
        this.animateType = 'animate__bounceOut'
      } else if (this.title === '入场动画4') {
        this.animateType = 'animate__flipInY'
      } else if (this.title === '离场动画4') {
        this.animateType = 'animate__flipOutY'
      } else if (this.title === '入场动画5') {
        this.animateType = 'animate__slideInLeft'
      } else if (this.title === '离场动画5') {
        this.animateType = 'animate__slideOutLeft'
      } else if (this.title === '入场动画6') {
        this.animateType = 'animate__lightSpeedInLeft'
      } else if (this.title === '离场动画6') {
        this.animateType = 'animate__lightSpeedOutLeft'
      } else if (this.title === '入场动画7') {
        this.animateType = 'animate__rotateIn'
      } else if (this.title === '离场动画7') {
        this.animateType = 'animate__rotateOut'
      } else if (this.title === '入场动画8') {
        this.animateType = 'animate__rotateInDownLeft'
      } else if (this.title === '离场动画8') {
        this.animateType = 'animate__rotateOutDownLeft'
      } else if (this.title === '入场动画9') {
        this.animateType = 'animate__rotateInDownLeft'
      } else if (this.title === '离场动画9') {
        this.animateType = 'animate__rotateOutDownLeft'
      } else if (this.title === '入场动画10') {
        this.animateType = 'animate__rollIn'
      } else if (this.title === '离场动画10') {
        this.animateType = 'animate__rollOut'
      } else if (this.title === '入场动画11') {
        this.animateType = 'animate__flipInX'
      } else if (this.title === '离场动画11') {
        this.animateType = 'animate__flipOutX'
      } else if (this.title === '入场动画12') {
        this.animateType = 'animate__zoomInDown'
      } else if (this.title === '离场动画12') {
        this.animateType = 'animate__zoomOutDown'
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  width: 210px;
  height: 250px;
  background-color: rgba(0, 245, 0, 0.5);
  display: flex;
  flex-direction: column;
  animation-duration: 1.5s; /* don't forget to set a duration! */
  --animate-delay: 0.8s;
  .header {
    width: 200px;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    color: #fff;
    animation-duration: 1s; /* don't forget to set a duration! */
    --animate-delay: 0.3s;
    // --animate__infinite: infinite;
  }
  .content {
    width: 200px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.5);
    margin-top: 10px;
    animation-duration: 1.3s; /* don't forget to set a duration! */
    --animate-delay: 0.5s;
    // --animate__infinite: infinite;
  }
}
</style>
